//页面白名单
const whiteList = [
	'/user-pages/bindPhone',
]

function hasPermission(url) {
	//请求路径在白名单中直接跳转，或者带有token直接跳转，
	let userId = getApp().globalData.userInfo.id;
	if(userId){
		return true
	}else{
		return false	 
	}
}
uni.addInterceptor('navigateTo', {
	invoke(e) {
		console.log(e)
		if (!hasPermission(e.url)) {
			uni.navigateTo({
				url: '/pages/loginOnlyPhone/loginOnlyPhone'
			})
			return false
		}
		return true
	},
	success(e) {
		console.log(e)
	},
	fail(e) {
		console.log(e)
	}
})
